<template>
  <div class="houtai">
    <Header />
    <div class="left">
      <div class="zhuyediv">
        <img src="@/assets/image/zhuye.png" alt="" class="zhuyeimg" />
      </div>
      <el-collapse accordion>
        <el-collapse-item
          v-for="(item, index) in data.leftlabellist"
          :key="index"
          :name="index"
          @click="collitem(item, index)"
        >
          <template #title>
            <img
              v-if="item.show == false"
              :src="item.img"
              alt=""
              class="imgfront"
            />
            <img v-else :src="item.imgactive" alt="" class="imgfront" />
            <span class="textbelong">{{ item.text }}</span>
          </template>
          <div
            v-for="(el, num) in item.list"
            :key="num"
            :class="['listitem', { activeclass: el.show == true }]"
            @click="itemclick(el, num, index)"
          >
            {{ el.text }}
          </div>
        </el-collapse-item>
      </el-collapse>
    </div>
    <div class="right">
      <div class="rtoprwlb">任务列表</div>
      <el-form
        :model="form"
        label-width="auto"
        style="width: 100%"
        :inline="true"
      >
        <el-form-item>
          <el-select v-model="form.orgName" placeholder="请输入设备名称">
            <el-option
              v-for="(item, index) in orgNameList"
              :key="index"
              :label="item"
              :value="item"
            />
            <el-option label="所有" value="" />
          </el-select>
        </el-form-item>
        <el-form-item>
          <el-input
            placeholder="请输入内容"
            class="tableinput"
            v-model="form.username"
          ></el-input>
        </el-form-item>
        <!-- <el-form-item>
          <el-input
            placeholder="联系电话"
            class="tableinput"
            v-model="form.mobile"
          ></el-input>
        </el-form-item>
        <el-form-item>
          <el-select v-model="form.taskStatus" placeholder="请输入完成状态">
            <el-option label="未完成" value="未完成" />
            <el-option label="已完成" value="已完成" />
            <el-option label="所有" value="" />
          </el-select>
        </el-form-item> -->
        <el-form-item>
          <el-button color="#0098C9" @click="viewlook">查询</el-button>
          <el-button color="#0098C9">新增</el-button>
          <el-button color="#0098C9">导入</el-button>
          <el-button color="#0098C9">模板下载</el-button>
        </el-form-item>
      </el-form>
      <div class="righttable">
        <el-table
          ref="multipleTableRef"
          :data="data.tableData"
          style="width: 100%; background-color: transparent"
        >
          <!-- <el-table-column type="selection" width="20" /> -->
          <el-table-column
            type="index"
            label="序号"
            width="60"
            align="center"
          />
          <el-table-column
            label="设备名称"
            width="120"
            prop="orgName"
            align="center"
          >
          </el-table-column>
          <el-table-column
            prop="username"
            label="设备型号"
            width="120"
            align="center"
          />
          <el-table-column prop="mobile" label="设备编码" align="center" />
          <el-table-column prop="startTime" label="设备经度" align="center" />
          <el-table-column prop="endTime" label="设备纬度" align="center" />
          <el-table-column prop="taskStatus" label="设备功能" align="center">
            <template v-slot="scoped">
              {{ scoped.row.complete }}/{{ scoped.row.allComplete }}户
            </template>
          </el-table-column>
          <el-table-column label="操作" align="center">
            <template #default>
              <el-button size="small" color="#00A8DF">编辑</el-button>
              <el-button size="small" color="#00A8DF">删除</el-button>
            </template>
          </el-table-column>
        </el-table>
      </div>
    </div>
  </div>
</template>

<script setup>
import Header from "../home/header.vue";
import { ref, reactive } from "vue";
let orgNameList = reactive([]);
let active = ref(0);
let form = reactive({
  orgName: "",
  username: "",
  mobile: "",
  taskStatus: "",
});
let data = reactive({
  tableData: [
    {
      id: 1,
      orgName: "供电所",
      username: "张三",
      mobile: "13757868908",
      startTime: "2023/12/4",
      endTime: "2023/12/4",
      taskStatus: "100/300户",
    },
    {
      id: 2,
      orgName: "供电所",
      username: "王五",
      mobile: "13757868908",
      startTime: "2023/12/4",
      endTime: "2023/12/4",
      taskStatus: "100/300户",
    },
    {
      id: 3,
      orgName: "供电所",
      username: "李四",
      mobile: "13757868908",
      startTime: "2023/12/4",
      endTime: "2023/12/4",
      taskStatus: "100/300户",
    },
    {
      id: 4,
      orgName: "供电所",
      username: "张三",
      mobile: "13757868908",
      startTime: "2023/12/4",
      endTime: "2023/12/4",
      taskStatus: "100/300户",
    },
    {
      id: 5,
      orgName: "供电所",
      username: "李四",
      mobile: "13757868908",
      startTime: "2023/12/4",
      endTime: "2023/12/4",
      taskStatus: "100/300户",
    },
    {
      id: 6,
      orgName: "供电所",
      username: "王五",
      mobile: "13757868908",
      startTime: "2023/12/4",
      endTime: "2023/12/4",
      taskStatus: "100/300户",
    },
    {
      id: 7,
      orgName: "供电所",
      username: "陈皮",
      mobile: "13167458546",
      startTime: "2023/12/4",
      endTime: "2023/12/4",
      taskStatus: "100/300户",
    },
  ],
  tableData2: [],
  leftlabellist: [
    {
      text: "设备管理",
      img: require("@/assets/image/shebei.png"),
      imgactive: require("@/assets/image/shebeiactive.png"),
      show: false,
      list: [
        {
          text: "泄洪闸",
          show: true,
        },
        {
          text: "水雨情",
          show: false,
        },
        {
          text: "渗流计",
          show: false,
        },
        {
          text: "渗压计",
          show: false,
        },
      ],
    },
    {
      text: "告警管理",
      img: require("@/assets/image/gaojin.png"),
      imgactive: require("@/assets/image/gaojinactive.png"),
      show: false,
      list: [
        {
          text: "泄洪闸",
          show: false,
        },
        {
          text: "水雨情",
          show: false,
        },
        {
          text: "渗流计",
          show: false,
        },
        {
          text: "渗压计",
          show: false,
        },
      ],
    },
  ],
});
const itemclick = (el, num, index) => {
  data.leftlabellist[index].list.forEach((m, n) => {
    m.show = false;
  });
  el.show = true;
};
const collitem = (it, ind) => {
  data.leftlabellist.forEach((item) => {
    item.show = false;
  });
  it.show = true;
};
</script>

<style lang="scss" scoped>
.houtai {
  position: absolute;
  width: 100%;
  height: 100vh;
  left: 0px;
  top: 0px;
  overflow: hidden;
}

.left {
  position: absolute;
  top: 106px;
  left: 0px;
  width: 200px;
  height: 974px;
  background: #00304a;
  border-radius: 0px;
  .zhuyediv {
    width: 100%;
    height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
    .zhuyeimg {
      width: 40px;
      height: 40px;
    }
  }
  .imgfront {
    width: 30px;
    height: 30px;
    vertical-align: middle;
  }
  .textbelong {
    display: inline-block;
    font-family: "Source Han Sans CN";
    // font-weight: bold;
    font-size: 16px;
    // line-height: 120px;
    color: #ffffff;
    // line-height: 22px;
    // letter-spacing: 100px;
    // text-align: left;
    font-style: normal;
    text-transform: none;
  }
  .listitem {
    width: 100%;
    height: 40px;
    // background: #438ebe;
    border-radius: 0px 0px 0px 0px;
    line-height: 40px;
    text-align: center;
    color: #ffffff;
  }
  .itemclass {
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 40px;
    gap: 10px;
    margin-top: 40px;
    cursor: pointer;
  }
}
.right {
  position: absolute;
  left: 210px;
  top: 106px;
  width: 1710px;
  height: 974px;
  background: #00304a;
  border-radius: 0px 0px 0px 0px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 18px;
  padding: 30px 30px 56px 30px;
  box-sizing: border-box;
  .rtoprwlb {
    font-family: AlimamaShuHeiTi, AlimamaShuHeiTi;
    font-weight: bolder;
    font-size: 18px;
    color: #95e5ff;
    // line-height: 22px;
    // letter-spacing: 100px;
    // text-align: left;
    font-style: normal;
    text-transform: none;
  }
  .righttable {
    width: 1651px;
    height: 800px;
    border-radius: 8px;
    background: #003958;
  }
}

::v-deep {
  .el-form {
    height: 32px !important;
    margin: 0px;
  }
  .el-collapse {
    border: none;
  }

  .el-collapse-item__header {
    width: 100%;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(180deg, #3991c1 0%, #173c51 100%);
    color: #ffffff;
    gap: 12px;
    border: none;
  }
  .el-collapse-item__arrow {
    margin: 0px !important;
  }
  .el-collapse-item__wrap {
    height: 160px;
    border: none;
  }
  .el-collapse-item__content {
    width: 200px;
    height: 160px;
    background: #005380;
    border-radius: 0px 0px 0px 0px;

    display: flex;
    flex-direction: column;
    align-items: center;
  }
  .activeclass {
    background: #438ebe !important;
  }
  .el-input__inner {
    color: #ffffff !important;
  }
  .el-select__placeholder {
    color: #ffffff !important;
  }
  .el-table td,
  .el-table th,
  .el-table tr {
    background: transparent !important;
    // border: none;
    color: #ffffff;
  }
  .el-table td.el-table__cell,
  .el-table th.el-table__cell.is-leaf {
    border-bottom: 1px solid #00a8df !important;
    border-right: 1px solid #00a8df !important;
  }
  .el-table td.el-table__cell:last-child {
    border-right: 0px !important;
  }
  .el-table th.el-table__cell.is-leaf:last-child {
    border-right: 0px !important;
  }
  //   .el-table td.el-table__cell:first-child {
  //     border-right: 0px !important;
  //   }
  //   .el-table th.el-table__cell.is-leaf:first-child {
  //     border-right: 0px !important;
  //   }
  .el-table__inner-wrapper:before {
    height: 0px;
  }
  .el-table__header-wrapper {
    background: #0079a1 !important;
    border-radius: 4px 4px 0px 0px;
  }
  .el-table tr {
    // border-bottom: 1px solid #00a8df !important;
  }
  .tableinput {
    width: 170px;
    height: 30px;
    background: #006d92;
    border-radius: 4px 4px 4px 4px;
  }
  .el-select {
    width: 170px !important;
    height: 30px !important;
    background: #006d92 !important;
    border-radius: 4px 4px 4px 4px !important;
    border: 0px solid #00a8df !important;
  }
  // .el-select:focus,
  // .el-select:hover,
  // .el-select:focus-visible {
  //   box-shadow: none !important;
  // }
}
</style>